package com.woniu.controller;

import com.woniu.entity.User;
import com.woniu.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class HelloController {
    @RequestMapping("/hello")
    public String hello(){
        System.out.println("hello mvc");
        return "index.html";
    }

    @RequestMapping("/hello2")
    @ResponseBody
    public String hello2(){
        System.out.println("hello mvc");
        return "index.html";
    }
    @Resource
    private UserService userService;
    @RequestMapping("/user")
    @ResponseBody
    public List<User> findAll(){
        List<User> all = userService.findAll();
        return all;
    }

}
